<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'createlab.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link rel="stylesheet" type="text/css" href="<%=basePath%>css/style.css">
<script type="text/javascript" src="<%=basePath%>js/jquery-1.8.3.js"></script>
<style type="text/css">
span {
	font-size: 20px;
}

form {
	padding-left: 20px;
	padding-top: 20px;
}
</style>
</head>
<body>
	<ul id="tabsmenu" class="tabsmenu">
		<li class="active"><a>导出课程</a>
		</li>
	</ul>
	<div id="tab1" class="tabcontent">
		<form action="exportexcel.action" method="post">
			<c:if test="${teacher.username!='admin' }">
				<input type="hidden" value="${teacher.name }" name="name">
			</c:if>
			<c:if test="${teacher.username=='admin' }">
				<input type="hidden" value="admin" name="name">
			</c:if>
			<span>请输入导出的周数：</span><br /> <input type="text" name="week"><br />
			<span>请输入导出的实验室：</span>
			<div id="labelRoom" status="false"></div>
			<input type="submit" class="button red" value="确认导出"
				style="width: 200px;height: 30px;">
		</form>
	</div>
</body>

<script type="text/javascript">
	$(document)
			.ready(
					function() {
						var status = $("#labelRoom").attr("status");
						if ("false" == status) {
							$
									.ajax({
										type : "post",
										url : "ajaxlab.action",
										dataType : "json",
										success : function(data) {
											var content = "";
											$
													.each(
															data,
															function(i, item) {
																var LId = item["LId"];
																var labName = item["labName"];
																content += "<input type='checkbox' name='labids' value='"+LId+"'>"
																		+ labName
																		+ "";
															});
											$("#labelRoom").append(content);
											$("#labelRoom").attr("status",
													"true");
										},
										error : function(XMLHttpRequest,
												textStatus, errorThrown) {
											console.info(errorThrown);
										}
									});
						}
					});
</script>
</html>
